package fr.afcepf.atod21.brigade.entity;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the equipe database table.
 * 
 */
@Entity
@NamedQuery(name="Equipe.findAll", query="SELECT e FROM Equipe e")
public class Equipe implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="id_equipe")
	private int idEquipe;

	private String nom;

	//bi-directional many-to-one association to Brigadier
	@OneToMany(mappedBy="equipe")
	private List<Brigadier> brigadiers;

	//bi-directional many-to-one association to Intervention
	@OneToMany(mappedBy="equipe")
	private List<Intervention> interventions;

	public Equipe() {
	}

	public int getIdEquipe() {
		return this.idEquipe;
	}

	public void setIdEquipe(int idEquipe) {
		this.idEquipe = idEquipe;
	}

	public String getNom() {
		return this.nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public List<Brigadier> getBrigadiers() {
		return this.brigadiers;
	}

	public void setBrigadiers(List<Brigadier> brigadiers) {
		this.brigadiers = brigadiers;
	}

	public Brigadier addBrigadier(Brigadier brigadier) {
		getBrigadiers().add(brigadier);
		brigadier.setEquipe(this);

		return brigadier;
	}

	public Brigadier removeBrigadier(Brigadier brigadier) {
		getBrigadiers().remove(brigadier);
		brigadier.setEquipe(null);

		return brigadier;
	}

	public List<Intervention> getInterventions() {
		return this.interventions;
	}

	public void setInterventions(List<Intervention> interventions) {
		this.interventions = interventions;
	}

	public Intervention addIntervention(Intervention intervention) {
		getInterventions().add(intervention);
		intervention.setEquipe(this);

		return intervention;
	}

	public Intervention removeIntervention(Intervention intervention) {
		getInterventions().remove(intervention);
		intervention.setEquipe(null);

		return intervention;
	}

}